﻿@{
    var sels = (SelectList)ViewData["Selects"];
    var htmlatt = (object)ViewData["htmlatt"];
    var optlabel = (string)ViewData["optlabel"];
}
<span>
<style type="text/css">
    a.selected
    {
        background-color:red;color:white;
        }
</style>
@*@Html.DropDownListFor(model => model, sels,optlabel,htmlatt)*@
@Html.HiddenFor(model => model)
@foreach (var item in sels)
{
    <a href="#" class="@(item.Selected?"selected":"noselected")" onclick="$('#SortOrder').val((!$(this).hasClass('selected')||$('#SortOrder').val()!='Asc')?'Asc':'Desc');$(this).closest('span').find('input').val($(this).text());$(this).closest('form').submit();return void(0);">@item.Text</a>
}
</span>